def solution(n: int, k: int) -> int:
    # write code here
    result = []
    for i in range(1, n+1):
        result.append(k*i)
    # print(result)
    return sum(result)


if __name__ == '__main__':
    print(solution(n=3, k=1) == 6)
    print(solution(n=2, k=2) == 6)
    print(solution(n=4, k=3) == 30)